<?php

my_component_load('paging' , false);  
my_component_load('penilaian' , false);  
my_component_load('xl_builder' , false);
my_component_load('pr_perf_appraisal' );
$struktur_gaji = isset($_GET['sgid']) ? $_GET['sgid']: 0;
$pid = isset($_GET['pid']) ? $_GET['pid']: 0;
$task = isset($_GET['task']) ? $_GET['task']: '';


if($_SERVER['REQUEST_METHOD'] == "POST" ){
	upload_kenaikan_pa_csv();
	$periode_id = get_periode_gaji();
	my_direct('index.php?com='.$_GET['com'].'&task=list_result&pid='.$periode_id );
}else{
	if( $task == "list_result" ){
		$content = upload_result_page($pid);
	}
	elseif($task == 'upload'){
		$content = upload_form_page();
	}elseif($task == 'list_excel'){
		header("Content-Type: application/xls");;
		$date_fix = get_tanggal_by_periode($pid);
		header("Content-Disposition: attachment;filename=kenaikan_gaji_pa_{$date_fix}.xls");
		echo report_excel_page($pid);
		exit;
	}
	else{
		$pid = default_periode_id(); 
		$content = upload_result_page($pid);
	}
}

generate_my_web( $content , "Upload kenaikan merit pa" );